package com.itheima.socket.tcp.demo06;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;

public class ClientDemo06 {

    public static void main(String[] args) throws IOException {

        Socket socket = new Socket("192.168.19.34", 9898);
        OutputStream outputStream = socket.getOutputStream();
        outputStream.write("hello".getBytes("UTF-8"));

        InputStream inputStream = socket.getInputStream();
        byte[] bytes = new byte[1024];
        int read = inputStream.read(bytes);
        System.out.println(new String(bytes, 0, read));
        socket.close();
    }
}
